#import "YawnFlowController.h"
        
#import "YawnFlowModel.h"
#import "YawnFlowCell.h"
#import "Masonry.h"

@interface YawnFlowController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *magnitudeUnwindYieldTableView;
@property (nonatomic, strong) NSMutableArray *insectNaturalArray;

@end

@implementation YawnFlowController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self xylophoneDelightfulSetuplayout];
	[self prismfetchData];
}


//: 懒加载数据模型数组
- (NSMutableArray *)insectNaturalArray {
	if (!_insectNaturalArray) {
		_insectNaturalArray = [NSMutableArray array];
	}
	return _insectNaturalArray;
}

- (void)xylophoneDelightfulSetuplayout {
    self.magnitudeUnwindYieldTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.magnitudeUnwindYieldTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    self.magnitudeUnwindYieldTableView.estimatedRowHeight = 0;
    self.magnitudeUnwindYieldTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.magnitudeUnwindYieldTableView.contentInset = UIEdgeInsetsMake(16, 0, 16, 0);
    self.magnitudeUnwindYieldTableView.delegate = self;
    self.magnitudeUnwindYieldTableView.dataSource = self;
    self.magnitudeUnwindYieldTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.magnitudeUnwindYieldTableView.showsVerticalScrollIndicator = NO;
    self.magnitudeUnwindYieldTableView.showsHorizontalScrollIndicator = NO;
    self.magnitudeUnwindYieldTableView.backgroundColor = UIColor.clearColor;
    [self.magnitudeUnwindYieldTableView registerClass:[YawnFlowCell class] forCellReuseIdentifier:NSStringFromClass([YawnFlowCell class])];
    [self.view addSubview:self.magnitudeUnwindYieldTableView];
    [self.magnitudeUnwindYieldTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(self.view);
        make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
    }];
}

//: 获取数据模型
- (void)prismfetchData {
	
}

#pragma mark - UITableView DataSource 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.insectNaturalArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    YawnFlowCell *archiveFlutterCirculate = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([YawnFlowCell class])];
    if (archiveFlutterCirculate == nil) {
        archiveFlutterCirculate = [[YawnFlowCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([YawnFlowCell class])];
    }
    archiveFlutterCirculate.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return archiveFlutterCirculate;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	YawnFlowModel *jeopardyBlossomConquer = self.insectNaturalArray[indexPath.row];
	return jeopardyBlossomConquer.elevateWispOasisCellHeight;
}


#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // cell tap action
}


@end
